# Condition control
snippet     if
abbr        if () {}
prev_word   '^'
    if (${1:/* condition */})
    {
        ${0:/* code */}
    }

snippet     elseif
abbr        elseif () {}
prev_word   '^'
    else if (${1:/* condition */})
    {
        ${0:/* code */}
    }

snippet     else
abbr        else {}
prev_word   '^'
    else
    {
        ${0:/* code */}
    }

snippet     ifelse
abbr        if () {} else {}
prev_word   '^'
    if (${1:/* condition */})
    {
        ${2:/* code */}
    }
    else
    {
        ${0:/* code */}
    }

snippet     switch
abbr        switch () {}
prev_word   '^'
    switch (${1:/* variable */})
    {
        ${0:/* code */}
    }

snippet     case
abbr        case: ... break;
prev_word   '^'
    case ${1}:
        ${0:/* code */}
        break;

snippet     default
abbr        default: ... break;
prev_word   '^'
    default:
        ${0:/* code */}
        break

snippet     cond
abbr        () ? :
prev_word   '^'
    (${1:/* condition */}) ? ${2:a} : ${0:b}

# Loop control
snippet     for
abbr        for (0...) {}
prev_word   '^'
    for (${1:i} = 0; $1 < ${2}; $1++)
    {
        ${0:/* code */}
    }

snippet     forx
abbr        for (...) {}
prev_word   '^'
    for (${1:/* init */}; ${2:/* condition */}; ${3:/* loop */})
    {
        ${0:/* code */}
    }

snippet     while
abbr        while () {}
prev_word   '^'
    while (${1:/* condition */})
    {
        ${0:/* code */}
    }

snippet     dowhile
abbr        do {} while ()
prev_word   '^'
    do
    {
        ${0:/* code */}
    } while (${1:/* condition */});

# Data structure
snippet     struct
abbr        struct {}
prev_word   '^'
    struct ${1:/* name */}
    {
        ${0:/* member */}
    };

snippet     struct_typedef
abbr        typedef struct {}
prev_word   '^'
    typedef struct ${1:/* name */}
    {
        ${0:/* member */}
    } ${2:$1_s};

snippet     enum
abbr        enum {}
prev_word   '^'
    enum ${1:/* name */}
    {
        ${0:/* member */}
    };

snippet     enum_typedef
abbr        typedef enum {}
prev_word   '^'
    typedef enum ${1:/* name */}
    {
        ${0:/* member */}
    } ${2:$1_e};

snippet     typedef
abbr        typedef ... ;
prev_word   '^'
    typedef ${1:base} ${2:custom};${0}

# Macro
snippet     inc
abbr        #include <>
prev_word   '^'
    #include <${1:stdio}.h>${0}

snippet     Inc
abbr        #include ""
prev_word   '^'
    #include "${1:file}.h"${0}

snippet     def
abbr        #define
prev_word   '^'
    #define 

snippet     DEF
abbr        #ifndef ... #define ... #endif
prev_word   '^'
    #ifndef $1
    #define ${1:SYMBOL} ${2:value}
    #endif${0}

snippet     once
abbr        include-guard
prev_word   '^'
    #ifndef ${1:SYMBOL}
    #define $1

    ${0}

    #endif /* end of $1 */

# Function
snippet     main
abbr        main() {}
prev_word   '^'
    int main(int argc, const char *argv[])
    {
        ${0:/* code */}

        return 0;
    }

snippet     func
abbr        func() {}
prev_word   '^'
    ${1:void} ${2:func}(${3:void})
    {
        ${0:/* code */}
    }

snippet     printf
abbr        printf() {}
prev_word   '^'
    printf("${1}\n"${2});${0}

snippet     fprintf
abbr        fprintf() {}
prev_word   '^'
    fprintf(${1:stderr}, "${2}\n"${3});${0}

# Comment
snippet     func_comment
abbr        function header comment
prev_word   '^'
    /*
     * Function: ${1}
     *     Desc: ${2}
     *   Params: ${3}
     *   Return: ${4}
     */${0}

snippet     file_comment
abbr        file header comment
prev_word   '^'
    /*
     * `expand("%:t")` ${1}
     * Time-stamp: <>
     *
     * Copyright (C) 2011-2012 ${2:`g:Company`}
     *
     *  Author: ${3:`g:Author`} (${4:`g:Email`})
     * Version: 0.1
     * Created: `strftime("%Y-%m-%d %H:%M:%S")`
     */${0}
